#ifndef PROTO_MGR_H__
#define PROTO_MGR_H__

//#include "GlbDefs.h"
//#include <google/protobuf/message.h>
#include <boost/shared_ptr.hpp>
//#include <boost/filesystem.hpp>
#include <QFileInfo>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <map>

namespace google
{
	namespace protobuf
	{
		namespace compiler
		{
			class Importer;
		}
		class Message;
		class DynamicMessageFactory;
	}
}

class ProtoMgr
{
public:
	ProtoMgr(void);
	virtual ~ProtoMgr(void);
	void* LoadProto(const std::string& inProtoFile, const std::string &strTypeName);
	int PrintMap(const std::string strMsgName, const std::map<std::string, std::string> Key2ValueMap);
	int PrintVector(const std::string strMsgName, const std::vector<std::string> &vecStrAttr);
	int Parse(const std::string &strBinary, std::ostringstream &ossOutput);
	void Close();

private:
	boost::shared_ptr<google::protobuf::compiler::Importer> m_importer;
	boost::shared_ptr<google::protobuf::DynamicMessageFactory> m_message_factory;
	boost::shared_ptr<google::protobuf::Message> pMsg;
};

#endif
